home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
bytjl86a.arc
/
SPREAD.ARC
/
SPREAD.DEF
< prev
next >
Wrap
Text File
|
1985-07-12
|
3KB
|
83 lines
DEFINITION MODULE Spreadsheet;
(* Defines the spreadsheet data type. There are a variety of implementations:
The DUMB implementation is just an array. In automatic mode, every time a
value is set, it recalculates the whole spreadsheet. It calls the display
handler to redraw those cells which have changed.
The DEPENDENCY implementation is an array with dependency information: each
cell knows which other cells depend on its value. In automatic mode, whenever
a value is changed the tree of dependencies is traversed depth-first, and
the display handler is called for each changed value.
The SPARSE DEPENDENCY implementation is like the dependency, but uses a sparse
array of blocks of cells instead of a real array.
The VIRTUAL SPARSE DEPENDENCY implementation is like the sparse dependency,
but will write blocks of cells to the disk when memory is full, and swap them
in as needed.
*)
FROM Formula IMPORT formula;
EXPORT QUALIFIED setValue, getValue, setFormula, getFormula, status,
Status, maxRow, maxCol, setAutomatic, setManual, recalculate,
init, inRange, operationStatus, clearAll;
TYPE Status = (OK, Empty, DivByZero, Overflow, Underflow,
RefError, RangeError, SyntaxError);
VAR operationStatus: Status;
(* Spreadsheet operations (like setValue, etc.) will set this to OK if
success, otherwise to an error status, usually RangeError. *)
PROCEDURE init;
PROCEDURE setValue(row, col:CARDINAL; value:REAL);
(* Sets the value of the cell at row, col. If automatic recalculation is
turned on, this will result in a recalc. operationStatus = RangeError
if row, col is out of range. *)
PROCEDURE getValue(row, col:CARDINAL):REAL;
(* Get the value at row, col. Returns 0.0 and sets operationStatus to
RangeError if out of range. *)
PROCEDURE setFormula(row, col:CARDINAL; f:formula);
(* Sets the formula. Computes the value for the cell and displays it.
operationStatus = RangeError if row, col out of range. *)
PROCEDURE getFormula(row, col:CARDINAL):formula;
(* Returns the formula. operationStatus = RangeError if out of range. *)
PROCEDURE clearAll;
(* Clears all the spreadsheet's cells. *)
PROCEDURE status(row, col:CARDINAL):Status;
(* Returns the cell's status. Can set operationStatus to RangeError. *)
PROCEDURE maxRow():CARDINAL;
(* Returns the maximum row value for the spreadsheet. *)
PROCEDURE maxCol():CARDINAL;
(* Returns the maximum column value for the spreadsheet. *)
PROCEDURE setAutomatic;
(* Sets recalc mode to automatic. *)
PROCEDURE setManual;
(* Sets recalc mode to manual. *)
PROCEDURE recalculate;
(* Recalculates the spreadsheet. Any cell which changes is redisplayed. *)
PROCEDURE inRange(row, col:CARDINAL):BOOLEAN;
(* Returns TRUE if row, col are within the bounds of the spreadsheet
(row between 1 and maxRow, column between 1 and maxCol). *)
END Spreadsheet.